<?php
require_once APP_PATH . '/post/model.php';
/**
 * 显示post页面
 * @param  string
 * @return [type]
 */
function post_list_action() {
	checkLogin();
	$category_id = isset($_GET['cid']) ? intval($_GET['cid']) : 0;
	$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
	$page_size = isset($_GET['num']) ? intval($_GET['num']) : 10;
	$keyword = isset($_GET['k']) ? trim($_GET['k']) : '';
	$search = !empty($keyword) ? 'k=' . $keyword : '';

	//获取数据
	$post_array = post_model_get_all_list_by_category_id($category_id, $page, $page_size, $keyword);
	$page_total_count = post_model_get_all_list_count_by_category_id($category_id, $keyword);
	$page_navigation = get_table_page_navigation($page_total_count, $page, $page_size, $search, '/' . APP_ADMIN_URI . '/post/list');
	include APP_ADMIN_VIEW . 'post/list.php';
}
